Definition:
- Testing asynchronous code becomes tricky as it is based on a future value that you might receive or might not.
Also Known As:
- Evergreen Tests, Success Against All Odds
Code Example:
test('the data is peanut butter', () => {
function callback(data) {
expect(data).toBe('peanut butter');
}
fetchData(callback);
});
References:
Quality attributes
- :octicon:`file-code;1em` - Code Example
- :octicon:`comment-discussion;1em` - Cause and Effect
- :octicon:`graph;1em` - Frequency
- :octicon:`sync;1em` - Refactoring
- Anti-Patterns - Digital Tapestry
- Categorising Test Smells :octicon:`graph;1em`
- Smells in software test code: A survey of knowledge in industry and academia
- TDD anti patterns - Chapter 1 :octicon:`file-code;1em`
- TDD anti-patterns - the liar, excessive setup, the giant, slow poke :octicon:`file-code;1em`
- Test-Driven Development: TDD Anti-Patterns
- Unit Testing Anti-Patterns, Full List